#include"vector.h"
#include<iostream>
#include<string>
using namespace std;
void test_vector1()
{
	My_Stl::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);

	My_Stl::vector<int>::const_iterator it = v.begin();
	while (it != v.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (int i = 0; i < v.size(); i++)
	{
		v[i]++;
	}

	for (auto e : v)
	{
		cout << e << " ";
	}

}

void test_vector2()
{
	My_Stl::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	My_Stl::vector<int> v1(v);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
	My_Stl::vector<int> v2;
	v2.push_back(6);
	v2.push_back(7);
	v2.reserve(10);
	cout << v2.size()<<endl;
	cout << v2.capacity() << endl;
	cout << v2.empty() << endl;
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
	v.resize(2);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
	v.resize(10,15);
	for (auto e : v)
	{
		cout << e << " ";
	}

}

void test_vector3()
{
	//My_Stl::vector<int> v;
	//v.push_back(1);
	//v.push_back(2);
	//v.push_back(3);
	//v.push_back(4);
	//v.push_back(5);
	//v.insert(v.begin(), 15);
	//v.insert(v.begin() + 1, 14);
	//v.insert(v.begin() + 7, 13);
	//for (auto e : v)
	//{
	//	cout << e << " ";
	//}
	//cout << endl;

	//My_Stl::vector<int> v;
	//v.push_back(1);
	//v.push_back(2);
	//v.push_back(3);
	//v.push_back(4);
	//v.push_back(5);
	//v.insert(v.begin(), 8 , 10);
	//for (auto e : v)
	//{
	//	cout << e << " ";
	//}
	//cout << endl;

	My_Stl::vector<char> v;
	v.push_back('a');
	v.push_back('b');
	v.push_back('c');
	v.push_back('d');

	std::string str("hello");
	v.insert(v.begin(),str.begin(), str.end());
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
	v.erase(v.begin());
	v.erase(v.end()-1);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
	v.erase(v.begin(),v.begin()+3);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

}


int main()
{
	test_vector3();
	return 0;
}